package com.whutosa.template.server.config;

import com.whutosa.template.server.interceptor.AddFieldInterceptor;
import com.whutosa.template.server.interceptor.CrossFieldInterceptor;
import com.whutosa.template.server.interceptor.TemplateInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by 19110 on 2016/8/5.
 */
@Configuration
public class InterceptorRegistrant extends WebMvcConfigurerAdapter {
    @Autowired
    private TemplateInterceptor templateInterceptor;
    @Autowired
    private CrossFieldInterceptor crossFieldInterceptor;
    @Autowired
    private AddFieldInterceptor addFieldInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(templateInterceptor);//添加拦截器，可以无限添加
        registry.addInterceptor(crossFieldInterceptor);
        registry.addInterceptor(addFieldInterceptor);
    }
}
